var globalGroups = new Array();

function Group(id){
	this.id=id;
	
	this.name=null;
	this.members = null;

	if(isNumeric(id)) global.addObjectItem('group',this,this.getKey());
}

Group.prototype.getKey = function(name){
	return 'group_'+this.id;
}

Group.prototype.assignProperties = function(name){
	this.set(name);
}

Group.prototype.setMembers = function(members){
	this.members = members;
}

Group.prototype.setObject = function(obj){
	for(var property in obj){
		this[property] = obj[property];
	}
}

Group.prototype.assignObject = function(obj){
	this.setObject(obj)
}

Group.prototype.set = function(name){
	this.name = name;
}

Group.prototype.createOwnGroupItem = function(obj){
	var ownGroup = document.createElement('DIV');
	ownGroup.className = 'ownedGroup item';

	var name = document.createElement('P');
	name.appendChild(document.createTextNode(this.name));

	setData(ownGroup, 'key', this.getKey());
	setEvent(ownGroup, 'click', createRoom);

	ownGroup.appendChild(name);

	return ownGroup;
}